package com.aipp.mall.common.utils;

import com.aipp.mall.common.exception.ServerException;
import org.dromara.hutool.core.text.StrUtil;

/**
 * 手机号工具类
 * @author Administrator
 */
public class PhoneUtils {

    public static String hidePhone(String phone) {
        if (StrUtil.isEmpty(phone) || phone.length() < 11) {
            throw new ServerException("手机号格式错误");
        }
        return phone.substring(0, 3) + "****" + phone.substring(7, 11);
    }
}
